#coding:utf-8
import os
import threading
global logFileLock
logFileLock = threading.Lock()

def _write(filename,content):
    try:
        logFileLock.acquire()
        f = None #initial
        f = open(filename, 'a+')
        f.write(content + '\n')        
    except:
        # add exception information
        pass
    finally:
        if not f.closed:
            f.close()
        logFileLock.release()